package com.zrwl.poscloud.xo.mapper;

import com.zrwl.poscloud.base.entity.Menus;
import com.zrwl.poscloud.base.superI.SuperMapper;
import com.zrwl.poscloud.xo.vo.MenusVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 功能菜单 Mapper类
 *
 * @author 刘思童 AutoGenerate
 * @date 2021-04-16
 */
public interface MenusMapper extends SuperMapper<Menus> {
    @Select(
            "<script>" +
                    " select * " +
                    "  FROM t_menus " +
                    "<where>" +" status=1 and menu_type=0 and super_uid=#{param.uid}"+
                    "</where>" +
                    "order by sort asc " +
                    "</script>"
    )
    List<MenusVO> selectChildren(@Param("param") MenusVO menusVO);

    @Select(
            "<script>" +
                    " select * " +
                    "  FROM t_menus " +
                    "<where>" +" status=1 and super_uid=#{param.uid}"+
                    "</where>" +
                    "order by sort asc " +
                    "</script>"
    )
    List<MenusVO> selectAllChildren(@Param("param") MenusVO menusVO);

    @Select(
            "<script>" +
                    " select * " +
                    "  FROM t_menus " +
                    " where status=1 and super_uid=#{param.uid}"+
                    " and uid in "+
                    " <foreach  item='item' index='index' collection='list' open='(' separator=',' close=')'>  #{item} " +
                    " </foreach>"+
                    "order by sort asc " +
                    " </script>"
    )
    List<MenusVO> selectroleMenusList(@Param("param") MenusVO menusVO, @Param("list") List<String> list);
}
